package com.friddle.Download.PageGet;

import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.http.HttpHost;

import java.util.Map;

/**
 * Created by friddle on 12/30/14.
 * make sure all the configure must be synchronized
 */
public class DefaultStrategy implements AntiStrategy {
	GetConfigure configure;

	public DefaultStrategy(GetConfigure configure) {
		this.configure = configure;
	}

	@Override
	public Map<String, String> getHttpCookie() {
		return this.configure.getCookies();
	}

	@Override
	public Map<String, String> getHttpHeaders() {
		return this.configure.getHeaders();
	}

	@Override
	public HttpHost getHttpProxys() {
		return null;
	}

	@Override
	public String getUserAgent() {
		return configure.getUserAgent();
	}

	@Override
	public int getSleepTime() {
		return configure.getSleepTime();
	}

	@Override
	public MutablePair<Boolean, String> isBlock(PageResult page) {
		MutablePair<Boolean, String> pair = new MutablePair<Boolean, String>();
		pair.setLeft(false);
		pair.setRight(null);
		return pair;
	}

	@Override
	public boolean changeTradegy(String errors) {
		return true;
	}


}
